﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Windows.Themes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace MyWpfFramework.ViewModels
{
    public partial class MainViewModel:ObservableObject
    {
       /// <summary>
       /// 默认亮色
       /// </summary>
        [ObservableProperty]
        private string? themeColor="DefaultColor";
        [RelayCommand]
        private void ChangeThemes()
        {
            var app = (App)Application.Current;
            if (themeColor == "DefaultColor")
            {
                app.ChangeTheme("Dark");
                themeColor = "DarkColor";
            }
            else
            {
                app.ChangeTheme("Light");
                themeColor = "DefaultColor";
            }
            
           
        }
       
    }
}
